home *** CD-ROM | disk | FTP | other *** search
/ The Trig Explorer / The Trig Explorer.iso / mac / Explorer / PI.dxr / 00107.ls < prev    next >
Encoding:
Text File  |  1998-07-22  |  1.7 KB  |  56 lines

  1. on enterFrame
  2.   set xCenter to ((the left of sprite 3 + the right of sprite 3) / 2) + 1
  3.   set yCenter to ((the top of sprite 3 + the bottom of sprite 3) / 2) + 1
  4.   set radius to (the width of sprite 3 / 2) - 2
  5.   set the trails of sprite 4 to 1
  6.   repeat with n = 0 to 360
  7.     if the mouseDown then
  8.       exit repeat
  9.     end if
  10.     set dy to float(radius) * float(sin((360 - n) * PI / 180.0))
  11.     set dx to float(radius) * float(cos(n * PI / 180.0))
  12.     drawLine(4, yCenter, xCenter, yCenter + dy, xCenter + dx)
  13.     if (n = 30) or (n = 60) or (n = 90) or (n = 180) or (n = 45) or (n = 270) or (n = 135) or (n = 360) then
  14.       if n = 180 then
  15.         put "pi Radians" into field "Degree"
  16.       end if
  17.       if n = 30 then
  18.         put "pi/6 Radians" into field "Degree"
  19.       end if
  20.       if n = 30 then
  21.         put "pi/6 Radians" into field "Degree"
  22.       end if
  23.       if n = 60 then
  24.         put "pi/3 Radians" into field "Degree"
  25.       end if
  26.       if n = 45 then
  27.         put "pi/4 Radians" into field "Degree"
  28.       end if
  29.       if n = 90 then
  30.         put "pi/2 Radians" into field "Degree"
  31.       end if
  32.       if n = 135 then
  33.         put "3/4‚Ä¢pi Radians" into field "Degree"
  34.       end if
  35.       if n = 270 then
  36.         put "3/2‚Ä¢pi Radians" into field "Degree"
  37.       end if
  38.       if n = 360 then
  39.         put "2‚Ä¢pi Radians" into field "Degree"
  40.       end if
  41.       updateStage()
  42.       startTimer()
  43.       repeat while the timer < (3 * 60)
  44.         if the mouseDown then
  45.           exit repeat
  46.         end if
  47.       end repeat
  48.       next repeat
  49.     end if
  50.     set the floatPrecision to 2
  51.     put n * PI / 180.0 & " Radians" into field "Degree"
  52.     updateStage()
  53.   end repeat
  54.   set the trails of sprite 4 to 0
  55. end
  56.